/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.app.certificate.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jeesite.common.config.Global;
import com.jeesite.common.entity.Page;
import com.jeesite.common.mapper.JsonMapper;
import com.jeesite.common.web.BaseController;
import com.jeesite.modules.conf.AppController;
import com.jeesite.modules.conf.MessageCode;
import com.jeesite.modules.zx.certificate.entity.Tcertificate;
import com.jeesite.modules.zx.certificate.service.TcertificateService;
import com.jeesite.modules.zx.user.entity.ZxUser;
import com.jeesite.modules.zx.user.service.ZxUserService;

/**
 * 证书管理Controller
 * @author zpp
 * @version 2020-02-20
 */
@Controller
@RequestMapping(value = "/app/certificate/")
public class AppCertificateController{

	@Autowired
	private TcertificateService tcertificateService;
	@Autowired
	private ZxUserService zxUserService;
	
	@RequestMapping(value="findList")
	public void list(Tcertificate tcertificate,HttpServletRequest request,HttpServletResponse response) {
		String userId=tcertificate.getUserId();
		if(StringUtils.isBlank(userId)){
			AppController.renderErrorString(response, MessageCode.PARAMETER_IS_NEED, "用户标识");
			return;
		}
		List<Tcertificate> findList = tcertificateService.findList(tcertificate);
		JSONArray parseObject = JSONObject.parseArray(JsonMapper.toJson(findList));
		AppController.renderSuccessObject(response, parseObject, MessageCode.SUCCESS_ACK);
	}
	
	
}